package com.xujiang.imitationcompanypj.data.model;

import android.content.Context;

import com.etekcity.vesync.common.util.AppUtils;
import com.etekcity.vesync.common.util.MD5Utils;
import com.etekcity.vesync.common.util.SystemException;

/**
 * Created by xujiang on 2017/4/5.
 */

public class Login {

    private String account;
    private String password;
    private String OS;
    private String appVersion;
    private String appVersionCode;
    private String devToken;

    public Login() {
    }

    public Login(String account, String password, String OS, String appVersion, String appVersionCode,
                 String devToken) {
        this.account = account;
        this.password = password;
        this.OS = OS;
        this.appVersion = appVersion;
        this.appVersionCode = appVersionCode;
        this.devToken = devToken;
    }

    public Login(Context context, String account, String password, String devToken) {
        this.account = account;
        this.password = password;
        this.devToken = devToken;
        this.OS = "android";
        try {
            this.appVersion = AppUtils.getVersionInfo(context).versionName;
            this.appVersionCode = String.valueOf(AppUtils.getVersionInfo(context).versionCode);
        } catch (SystemException e) {
            this.appVersion = "1.0";
            this.appVersionCode = "10";
        }
    }

    public void md5Password() {
        this.password = MD5Utils.md5ToString(this.password);
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getOS() {
        return OS;
    }

    public void setOS(String OS) {
        this.OS = OS;
    }

    public String getAppVersion() {
        return appVersion;
    }

    public void setAppVersion(String appVersion) {
        this.appVersion = appVersion;
    }

    public String getAppVersionCode() {
        return appVersionCode;
    }

    public void setAppVersionCode(String appVersionCode) {
        this.appVersionCode = appVersionCode;
    }

    public String getDevToken() {
        return devToken;
    }

    public void setDevToken(String devToken) {
        this.devToken = devToken;
    }

    @Override
    public String toString() {
        return "Login{" +
                "account='" + account + '\'' +
                ", password='" + password + '\'' +
                ", OS='" + OS + '\'' +
                ", appVersion='" + appVersion + '\'' +
                ", appVersionCode='" + appVersionCode + '\'' +
                ", devToken='" + devToken + '\'' +
                '}';
    }
}
